var Fly=require("flyio/dist/npm/wx")
var fly = new Fly

//配置项目根目录
fly.config.baseURL = "https://restapi.amap.com/v3"
fly.config.tiemout = 5000 
// 配置响应拦截器
fly.interceptors.response.use((response) => {
	uni.hideLoading()
	// 如果请求报错
	return response.data
},
(err) => {
	//网络发生错误
	return Promise.resolve("网络请求错误")
})
// 配置请求拦截
fly.interceptors.request.use((request) => {
	uni.showLoading({
		title: '温馨提示',
		mask: true
	})
	request.headers = {
		'content-type': 'application/json'
	}
	let authParams = {
		// 获取公共参数
		'key': 'b7506f0cb5324f496da4ba7659b71d88'
	}
	console.log(request.body)
	request.body = {
		...request.body,
		...authParams
	}
	return request
})

export default fly